package com.icetech.eom.service.ws;

import com.icetech.commonbase.JsonTools;
import com.icetech.eom.domain.response.WebServiceResponse;
import com.icetech.eom.service.Spring;
import com.icetech.eom.service.ws.cust.SpringDeviceServer;

/**
 * 设备服务接口 实现类
 * @author wangzw
 */
public class DeviceServer {

    public String getDevList(String para) {
        SpringDeviceServer springDeviceServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springDeviceServer = Spring.getBean("springDeviceServer");
            String reslut = springDeviceServer.getDeviceList(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    public String BindDev(String para) {
        SpringDeviceServer springDeviceServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springDeviceServer = Spring.getBean("springDeviceServer");
            String reslut = springDeviceServer.bindDevice(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    public String UnBind(String para) {
        SpringDeviceServer springDeviceServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springDeviceServer = Spring.getBean("springDeviceServer");
            String reslut = springDeviceServer.unBindDevice(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    public String UpdataDev(String para) {
        SpringDeviceServer springDeviceServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springDeviceServer = Spring.getBean("springDeviceServer");
            String reslut = springDeviceServer.updateDevice(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }

    public String CheckDev(String para) {
        SpringDeviceServer springDeviceServer;
        WebServiceResponse webServiceResponse = new WebServiceResponse();
        try {
            springDeviceServer = Spring.getBean("springDeviceServer");
            String reslut = springDeviceServer.checkDevice(para);
            return reslut;
        } catch (Exception e) {
            webServiceResponse.setState(-1+"");
            webServiceResponse.setRetmsg("系统异常");
            return JsonTools.toString(webServiceResponse);
        }
    }
}
